package demo2;

public class Test {
    public static void test1(Animal animal) {
        animal.eat();
    }
    public static void walks(IRunable runable) {
        runable.run();
    }
    public static void swims(ISwimable swimming) {
        swimming.swim();
    }
    public static void flys(IFlyable fly) {
        fly.fly();
    }
    public static void main(String[] args) {
        Dog dog = new Dog("大黄",5);
        Bird bird = new Bird("小飞",1);
        Duck duck = new Duck("大黄鸭",2);
        walks(dog);
        walks(duck);
        swims(dog);
        swims(duck);
        flys(bird);
        flys(duck);
    }

    public static void main1(String[] args) {
        Dog dog = new Dog("大黄",5);
        Bird bird = new Bird("小飞",1);
        Duck duck = new Duck("大黄鸭",2);

        test1(dog);
        test1(bird);
        test1(duck);
    }
}
